package com.yulinlin.web3j.domain;

import org.web3j.crypto.Credentials;
import org.web3j.crypto.WalletUtils;
import org.web3j.protocol.Web3j;

public class ETHSubject {

    private Credentials credentials;

    private Web3j web3 ;


    public ETHSubject(Web3j web3,String privateKey) {
        this.web3 = web3;
        this.credentials =  Credentials.create(privateKey);
    }

    /**
     * 得到一个币种
     * @param address 合约地址
     * @return
     */
    public EIP20Interface token(String address){
        if(address == null){
            return new ETHToken(web3,this);
        }
        return new EIP20InterfaceToken(address,web3,this);
    }


    public Credentials getCredentials() {
        return credentials;
    }
}
